<?php
	// if(isset($_COOKIE['name']))
	// {
		
	// }else
	// {
	// 	echo '<h3>您是非法登陆哟！</h3>';
	// 	header("Refresh:1;login.html");
	// 	exit;
	// }
	//讲真话，用类真的很方便
	/**
	 * 
	 */
	class MySQLonLife
	{
		public function MySQL_go($servername, $username, $password, $dbname ,$sql)
		{
			$conn = new mysqli($servername, $username, $password, $dbname);
			if ($conn->connect_error) 
			{
	  			die("连接失败: " . $conn->connect_error);
			} 
			else
			{
				//echo "链接成功！并执行语句！";
				$result = $conn->query($sql);
				if($result)
				{
					$conn->close();
					return $result;
				}
				else
				{
					//echo "链接成功！执行错误！";
					return false;
				}
			}
			
		}
	}
?>